<template>
	<view class="page">

		<custom-navigation title="流水详情">
		</custom-navigation>


		<scroll-view class="body-scroll" scroll-y="true">
			<view class="item-view flex-column-center">
				<view class="amount"
					:style="{'color':info.pay_amount>=0?'rgba(226, 36, 23, 1)':'rgba(56, 192, 158, 1)'}">
					{{(info.pay_amount>0?'+':'')+info.pay_amount}}</view>
				<view class="amount_hint">支付金额</view>
				<view class="value">支付方式：{{info.pay_type}} </view>
				<view class="value">支付流水号：{{info.serial_number}} </view>
				<view class="value">支付状态：{{info.pay_status}} </view>
				<view class="value">支付时间：{{info.pay_time}} </view>
			</view>
			<view class="item-view2 flex-column" style="margin-top: 20rpx;">
				<view class="title">流水信息</view>
				<view class="line"></view>
		 	 	<view class="value">订单号：{{info.order_no}} </view>
				<view class="value">门店：{{info.serial_number}} </view>
				<view class="value">操作员：{{info.operation_name}} </view>
				<view class="value">会员信息：{{info.member_name_str}} </view>
				<view class="value">操作类型：{{info.operation_type}} </view>
				<view class="value">支付渠道：{{info.pay_type}} </view>
				<view class="value">渠道来源：{{info._channel_source_str_disp}} </view>
				<view class="value">交易时间：{{info.create_time}} </view>
				<view class="value">备注：{{info.remark}} </view>
			</view>

		</scroll-view>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				delDialogShow: false,
				info: {},
				datas: [],
				countQty: 0,
				isEdit: false
			}
		},
		onLoad(options) {
			this.info = JSON.parse(options.info)
			this.getData()
		},
		onShow() {
			if (uni.getStorageSync("refresh")) {
				this.getData()
				this.getInfo()
				uni.setStorageSync("refresh", null);
			}
		},
		methods: {

			getAmount(item) {
				return (item.purchase_price ?? 0) * (item.warehousing_num ?? 1)
			},
			settingMultiple(type) { //0 删除，1 编辑，2 提交
				if (type == 0) {
					this.delStock();
				} else if (type == 1) {
					// this.isEdit = true;
					let info = JSON.stringify(this.info)
					uni.navigateTo({
						url: '/pages/warehousing/bill-stock?info=' + info
					})
				} else if (type == 2) {
					this.save(1)
				} else if (type == 3) //修改
				{
					this.save(0)
				}
			},
			delStock() {
				this.delDialogShow = true;
			},

			del() {
				uni.showLoading({
					title: "删除中..."
				})
				this.$apiPost("/retail/operate/srvretail_warehousing_delete", [{
					"serviceName": "srvretail_warehousing_delete",
					"condition": [{
						"colName": "id",
						"ruleType": "in",
						"value": this.info.id
					}]
				}]).then(res => {
					uni.hideLoading()
					uni.setStorageSync("refresh", true)
					if (res.state == "SUCCESS") {
						uni.showToast({
							title: "成功！",
							mask: true
						})

						setTimeout(() => {
							uni.navigateBack()
						}, 1500)
					}
				})
			},
			save(type) { //type 0 保存草稿，1 提交。
				uni.showLoading({
					title: "加载中..."
				})
				this.$apiPost("/retail/operate/srvretail_warehousing_update", [{
					"serviceName": "srvretail_warehousing_update",
					"condition": [{
						"colName": "id",
						"ruleType": "eq",
						"value": this.info.id
					}],
					"data": [{
						"warehousing_state": "已提交"
					}]
				}]).then(res => {
					uni.hideLoading()
					uni.setStorageSync("refresh", true)
					if (res.state == "SUCCESS") {
						uni.showToast({
							title: "成功！",
							mask: true
						})

						setTimeout(() => {
							uni.navigateBack()
						}, 1500)
					}
				})

			},
			getData() {
				uni.showLoading({
					title: "加载中..."
				})
				this.$apiPost("/retail/select/srvretail_warehousing_detail_select", {
					"serviceName": "srvretail_warehousing_detail_select",
					"colNames": ["*"],
					"condition": [{
						"colName": "warehousing_no",
						"ruleType": "eq",
						"value": this.info.warehousing_no
					}],
					"relation_condition": {},
					"page": {
						"pageNo": 1,
						"rownumber": 10
					}
				}).then(res => {
					uni.hideLoading()
					this.datas = res.data;
					this.countQty = 0;
					for (let i in res.data) {
						this.countQty += res.data[i].warehousing_num
					}
				})
			},


			getInfo() {
				this.$apiPost("/retail/select/srvretail_warehousing_select", {
					"serviceName": "srvretail_warehousing_select",
					"colNames": ["*"],
					"condition": [{
						"colName": "id",
						"ruleType": "eq",
						"value": this.info.id
					}],
					"page": {
						"pageNo": 1,
						"rownumber": 10
					}
				}).then(res => {
					if (res.data.length > 0) {
						this.info = res.data[0]
					}
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.page {
	background: rgba(245, 245, 247, 1);
	}

	.title-box {
		width: 100%;
		height: 100rpx;
		background: rgba(211, 242, 234, 1);
		padding: 0 20rpx;

		.name {
			font-size: 32rpx;
			font-weight: 700;
			line-height: 100rpx;
			color: rgba(51, 51, 51, 1);
			flex: 1;
		}

		.n1 {
			font-size: 28rpx;
			font-weight: 500;
			line-height: 100rpx;
			color: rgba(51, 51, 51, 1);
		}
	}

	.head-contaienr {
		.item {
			padding: 10rpx 24rpx;

			.value {
				flex: 1;
				font-size: 28rpx;
				font-weight: 500;
				color: rgba(51, 51, 51, 1);
			}
		}

		.bluebtn {
			width: 124rpx;
			height: 48rpx;
			text-align: center;
			line-height: 48rpx;
			border-radius: 4rpx;
			border: 2rpx solid rgba(56, 192, 158, 1);
			margin-right: 22rpx;
			font-size: 28rpx;
			font-weight: 500;
			color: rgba(56, 192, 158, 1);
		}

		.redbtn {
			width: 124rpx;
			height: 48rpx;
			text-align: center;
			line-height: 48rpx;
			border-radius: 4rpx;
			border: 2rpx solid rgba(212, 48, 48, 1);
			margin-right: 22rpx;
			font-size: 28rpx;
			font-weight: 500;
			color: rgba(212, 48, 48, 1);
		}
	}

	.item-view {
		background-color: #FFF;
		padding-left: 24rpx;
		padding-bottom: 28rpx;
		.amount {
			margin-top: 70rpx;
			font-size: 60rpx;
			font-weight: 700;
		}

		.amount_hint {
			margin-top: 8rpx;
			margin-bottom: 20rpx;
			font-size: 30rpx;
			font-weight: 500;
			color: rgba(153, 153, 153, 1);
		}

		.value {
			margin-top: 20rpx;
			width: 100%;
			font-size: 30rpx;
			color: rgba(153, 153, 153, 1);
			font-weight: 500;
		}
	}
	.item-view2 {
		background-color: #FFF;
		padding-left: 24rpx;
		padding-bottom: 28rpx;
		padding-top: 40rpx;
		.title{
			font-size: 36rpx;
			font-weight: 700;
			color: rgba(51, 51, 51, 1);
		}
		.line{
			margin-top: 20rpx;
			width: 702rpx;
			height: 1rpx; 
			border: 1rpx solid rgba(245, 245, 247, 1);      
		}
		.value {
			margin-top: 20rpx;
			width: 100%;
			font-size: 30rpx;
			color: rgba(153, 153, 153, 1);
			font-weight: 500;
		}
	}

	.bottom-container {
		background-color: white;
		box-shadow: 0 -16rpx 16rpx 1rpx #00000008;
		height: 146rpx;
		padding: 0 24rpx;
		justify-content: space-around;

		.item {
			border-radius: 40rpx;
			line-height: 80rpx;
			text-align: center;
			border: 2rpx solid #333333FF;
			width: 192rpx;
			height: 80rpx;
			font-size: 30rpx;
			font-weight: 500;

		}

		.item1 {
			border-radius: 40rpx;
			line-height: 80rpx;
			text-align: center;
			border: 2rpx solid rgba(56, 192, 158, 1);
			background-color: rgba(56, 192, 158, 1);
			color: white;
			width: 192rpx;
			height: 80rpx;
			font-size: 30rpx;
			font-weight: 500;
		}

		.text {
			flex: 1;
			margin-left: 60rpx;
			font-size: 30rpx;
			font-weight: 700;

		}

		.btn {
			margin-right: 34rpx;
			width: 192rpx;
			height: 80rpx;
			border-radius: 40rpx;
			background: rgba(56, 192, 158, 1);
			font-size: 30rpx;
			font-weight: 700;
			color: white;
			text-align: center;
			line-height: 80rpx;
		}
	}
</style>
<strong></strong>
